package unit7;

import java.sql.*;

public class QueryTest {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        String ur1="jdbc:mysql://localhost:3306/1613580010";
        String name="root";
        String password="123";
        //注册驱动
        Class .forName("com.mysql.jdbc.Driver");
        //建立连接
       Connection con= DriverManager.getConnection(ur1,name,password);
        //创建查询语句
        Statement s=con.createStatement();
        ResultSet rs=s.executeQuery("select*from t_student");
        while (rs.next()){
            String n=rs.getString("name");
            System.out.println("姓名:"+n);
        }
    }
}
